package database

import (
	"github.com/jinzhu/gorm"
	_ "github.com/jinzhu/gorm/dialects/mysql"
)

var (
	DB * gorm.DB
)

func InitMysql()(err error){
	DB,err = gorm.Open("mysql","go:123456@tcp(127.0.0.1:3306)/go")
	if err != nil{
		return err
	}
	return DB.DB().Ping()
}

func Close() {
	DB.Close()
}